<%@ page language="java" import="java.util.*,com.csd.pojo.Message,com.csd.helper.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List<Message> newMsg = (List<Message>)request.getAttribute("messageSendList");

Integer currPage = (Integer)request.getAttribute("currPage");
Integer totalPage = (Integer)request.getAttribute("totalPage");

if(currPage == null || currPage <= 0 )
	currPage = 1;
	
if(totalPage == null || totalPage <= 0)
	totalPage = 1;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="<%=path %>/common/css/rpms_right.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <div class="main">
        <h1>发送消息</h1>
        <hr />
        <form action="<%=path %>/receiverList.action" method="get">
        	<h3>发送新的消息</h3>
        	<table>
        		<tr>
        			<td width="80px">接收者类型:</td>
        			<td width="80px">
			        	<select name="type">
			        		<option value="<%=IConstant.managerRole %>">管理员</option>
			        		<option value="<%=IConstant.teacherRole %>">教师</option>
			        		<option value="<%=IConstant.teamRole %>">团队</option>
			        	</select>
		        	</td>
		        	<td>
		        		<input type="submit" value="  发送  " />
		        	</td>
	        	</tr>
        	</table>
        </form>
        <br />
        <h3>已发消息</h3>
        <table width="100%">
            <tr>
            
                <td class="table_head" width="200px">主题</td>
                <td class="table_head" width="100px">发送时间</td>
                <td class="table_head" width="100px">接收者</td>     
                <td class="table_head">操作</td>    
            </tr>
            <%if(newMsg != null && newMsg.size()>0) {%>
            <%for(Message i : newMsg){ %>
                <tr>
                <td> <%=i.getTitle() %></td>
                <td> <%=Tool.dateToString(i.getTime()) %></td>
                <td> <%=i.getReceiverid() %></td>
                <td>
                	<a href='<%=path %>/messageDetail.action?messageID=<%=i.getId() %>'>查看</a>
               		
                </td>
           		</tr>
           	<%} %>
			<%}else{ %>
				<tr>
					<td colspan="4" align="center">暂无消息</td>
				</tr>
			<%} %>
			<tr>
				<td colspan="4">
					<%if(currPage > 1){%>
					<a href="<%=path %>/messageSendList.action?currPage=1">首页</a> |
					<a href="<%=path %>/messageSendList.action?currPage=<%=currPage-1 %>">上一页</a> |
					<%} %>
					<span> 页面: <%=currPage %> </span>
					<%if(currPage < totalPage){%>
					| <a href="<%=path %>/messageSendList.action?currPage=<%=currPage+1 %>">下一页</a>
					| <a href="<%=path %>/messageSendList.action?currPage=<%=totalPage %>">尾页</a>
					<%} %>
				</td>
			</tr>
         </table>
    </div>
</body>
</html>

